package file_functions;

import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;

class Comp_date_1 implements Comparator<Files_info>
{
    public int compare(Files_info entry1, Files_info entry2) 
    {
    	if (entry1.name.equals(".."))
			return (-1);
		else if (entry2.name.equals(".."))
			return (1);
    	
    	SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
    	Date date1 = null, date2 = null;
    	try 
    	{
    		date1 = sdf.parse(entry1.date);
    		date2 = sdf.parse(entry2.date);
    	}
    	catch(Exception e) 
    	{}
    	return(date1.compareTo(date2));
    }
}
